package medium;

import java.util.ArrayList;
import java.util.Scanner;

public class GeneralPalindromicNumber_1019 {
		public static void solve() {
		        Scanner sc = new Scanner(System.in);
		        int N = sc.nextInt(),base = sc.nextInt();
		        ArrayList<Integer> res = decimalToBase(N,base);
		        boolean flag = true;
		        int left = 0, right = res.size() - 1;
		        while(left < right) {
		            if(!res.get(left).equals(res.get(right))) {
		                flag = false;
		                break;
		            }
		            left++;
		            right--;
		        }
		        if(flag)
		            System.out.println("Yes");
		        else
		            System.out.println("No");
		        System.out.print(res.get(res.size()-1));
		        for (int i = res.size() - 2; i >= 0; i--) {
		            System.out.print(" " + res.get(i));
		        }
		        sc.close();
		}
		
		private static ArrayList<Integer> decimalToBase(int N, int base) {
	        ArrayList<Integer> res = new ArrayList<Integer>();
	        if (N == 0)
	            res.add(0);
	        while (N != 0) {
	            res.add(N % base);
	            N /= base;
	        }
	        return res;
	    }
	
	
		public static void main(String[] args) {
			Scanner scan=new Scanner(System.in);
			int val=scan.nextInt();
			int radix=scan.nextInt();
			String res=Integer.toString(val, radix);
			if(help(res)) {
				System.out.println("Yes");
			}
			else
				System.out.println("No");
			char []chars=res.toCharArray();
			StringBuilder sb=new StringBuilder();
			for(char c:chars)
				sb.append(c).append(" ");
			sb.deleteCharAt(sb.length()-1);
			System.out.println(sb.toString());
			scan.close();
		}
		
		public static boolean help(String res) {
			int left=0,right=res.length()-1;
			while(left<right) {
				if(res.charAt(left)!=res.charAt(right))
					return false;
				++left;
				--right;
			}
			return true;
		}
}
